package com.puppet.bookstore_cache.TestDemo;

import com.puppet.bookstore_cache.pojo.Book;
import com.puppet.bookstore_cache.service.BookService;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
public class Testdemo {
    @Autowired
    private BookService bookService;

    @Test
    public void testFindById() {
        Book book = bookService.findById(7);
        System.out.println(book);
    }
    @Test
    public void testUpdate() {
        Book book = new Book();
        book.setId(5);
        book.setName("Java EE轻量级框架整合开发");
        book.setAuthor("黄药师");
        bookService.update(book);
        System.out.println("更新成功");
    }

    @Test
    public void testDeleteById() {
        bookService.delete(5);
        System.out.println("删除成功");
    }

    @Test
    public void testDeleteAll() {
        bookService.deleteAll();
        System.out.println("删除成功");
    }
}
